package com.example.gg.gitdemo;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.widget.Button;
import android.widget.TextView;


import org.androidannotations.annotations.AfterInject;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;
import org.simple.eventbus.EventBus;
import org.simple.eventbus.Subscriber;

/**
 * hehe
 */
@EActivity(R.layout.activity_main)
public class MainActivity extends AppCompatActivity {

    private EventBus eventBus = EventBus.getDefault();


    @AfterInject
    public void init() {
        eventBus.register(this);
    }

    @ViewById(R.id.btn_send)
    Button btnSend;
    @ViewById(R.id.tv_show)
    TextView tvShow;


    @Click(R.id.btn_send)
    public void onClick() {
        eventBus.post("你好！！！");
        Intent intent = new Intent(this,ReplyActivity_.class);
        startActivity(intent);

    }

    @Subscriber()
    public void getData(String msg){
        tvShow.setText(msg);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        eventBus.unregister(this);
    }
}
